package exception;

import entity.Result;
import entity.StatusCode;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author ：LiuShihao
 * @date ：Created in 2020/8/11 2:07 下午
 * @desc ：
 */
@ControllerAdvice
public class BaseExceptionHandler {
    /***
     * 异常处理 * @param e * @return */
    @ExceptionHandler(value = Exception.class) @ResponseBody
    public Result error(Exception e) {
        e.printStackTrace();
        return new Result(false, StatusCode.ERROR, e.getMessage());
    } }